<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>一键成团_{$order_good.goods_name}_{$web_name}</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="Keywords" content="一键成团,{$order_good.goods_name}" />
		<meta name="Description" content="一键成团,{$order_good.goods_name}" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
		<meta name="format-detection" content="telephone=no">
		<tc_include file="Public:head" />
			<link rel="stylesheet" type="text/css" href="/themes/wnsc/Home/Shop/css/group_detail_new.css"/>
	</head>

	<body style="background: #fff;">
		<tc_include file="Public:nav" />
		<php>
			if($order_info['tuan_is_first_id']==0){ 
				$num=get_tuan($order_info['order_id']); 
			}else{ 
				$num=get_tuan($order_info['tuan_is_first_id']); 
			} 
		</php>
		<div class="w990" id="content" style="background: #fff;">
			<div class="content" style="margin-top: 25px;">
				<section id="dealInfo-first" class="dealInfo" >
				<div class="p">
					<img class="p_pic" src="{$order_good.goods_image}">
				</div>
				<div class="d">
					<h3 class="d_tit">
			            {$order_good.goods_name}
			          </h3>
					<p class="d_info">
						<em><span class="tuanNum">{$order_info['tuannum']}人团：</span><span class="tuanPrice">¥<strong><span id="tuanPrice">{$shop_info.tuan_price}</span>/件</strong></span><span class="org">¥<em>{$shop_info.price}</em></span>
						</em>
					</p>
					<p><span class="mark">拼团多省<em>{$shop_info['price']-$shop_info['tuan_price']}</em>元</span><span class="lu_ru js_luru_btn">活动规则</span></p>
				</div>

			</section>
			<div class="tuanBox itemMode">
				<php>if($num==$order_info['tuannum']){</php>
				<i class="status success"></i>
				<php>}</php>
				<section class="groupUserimg">
					<i class="userImg head">
						<img src="/themes/wnsc_moblie/newMobile/Shop/images/tz.png">
					</i>
					<php>for($i=1;$i<$num;$i++){</php>
					<i class="userImg ">
						<img src="/themes/wnsc_moblie/newMobile/Shop/images/cy.png">
					</i>
					<php>}</php>
					
				</section>
			
				<section class="centerRemind btn-downapp js-btn-downapp">
					<php>if($num==$order_info['tuannum']){</php>
						<p>拼团成功~</p>
					<php>}else{</php>
						<p>还差<span class="num1" style="color: red;">{$order_info['tuannum']-$num}</span>人，快去邀请好友参团吧</p>
					<php>}</php>
				</section>
					<php>if($num==$order_info['tuannum']){</php>
						<div class="btn-goindex" onclick='location="/"'>去首页逛逛</div>
					<php>}else{</php>
						<div class="btn-goindex cantuan" data-goods-id="{$shop_info.id}" data-image-url="{$shop_info.image}" data-buy-enable="{$shop_info.num}">一键成团</div>
					<php>}</php>
				

				<!-- 附近的团 -->

			</div>
			<div class="like_list">
				<div class="hot_products" data-search-count="300">
					<div class="title"><span></span></div>
					<div class="hot_box">
						<foreach name="like_list" item="v">
							<php>$rs=shop_type($v['id']);</php>
						<div class="hot-list deal" onclick='location.href="{:U('shop/index',array('id'=>$v['id']))}"'>
							<div class="l"> <img style="width:197px;height:197px" src="{$v.image}" class="newImg">
								<php>if($rs['tuan']==1){</php><img src="/static/images/tuan.png" alt="此商品参与团购" style="position: absolute;z-index: 999;width: auto; height: auto;left:0px;"><php>}</php>
								<p class="txt"><php>if($rs['coupon']==1){</php><em style="background-image: url('/static/images/yhq.png');padding: 0 5px 0 11px;color: #fff;background-size: 100% 100%;margin-right: 5px;">优惠券</em><php>}</php>{$v.title}</p>
								<div class="btm clear">
									<div class="price-g"> <em>￥</em> <span class="y">{$v.price}</span>  </div>  </div>
								<div class="sales_block clear">
								<span class="sales">已售{$v.sale_num}件</span> </div>
							</div>
						</div>
						</foreach>
					</div>
				</div>

			</div>
			</div>
		</div>
		<div style="clear: both;"></div>
		<tc_include file="Public:footer" />
	
		<script type="text/javascript">
			$(function(){
				$(".cantuan").click(function(event) {
					var goods_id = $(this).data("goods-id");
					var image_url = $(this).data("image-url");
					var buy_enable = $(this).data("buy-enable");
					if(buy_enable==0){
						$.msg('商品库存不足！');
						return;
					}
					$.post('/cart/add', {
						goods_id: goods_id,
					}, function(result) {
						shop_info=result.data;
						var content='<div class="pop-choose-spec-mask" style="display: block;"></div>';
						//基本信息
						content +='<div class="pop-choose-spec-main" style="display: block;"><div class="pop-choose-spec-header"><img src="'+image_url+'" class="goods-thumb "><div class="attribute-header-right"><span class="goodprice choose-result-price"><em>￥{$shop_info.tuan_price}</em></span><span class="goods-number">库存'+shop_info.num+'件</span></div>	<a class="pop-choose-spec-close layui-layer-close" href="javascript:void(0);" title="关闭"></a></div><div class="pop-choose-spec-con">';
						//sku属性 start
						content+='<div class="attr-list choose" style="overflow: hidden;">';
						//颜色
						if(shop_info.shop_sku){
							SKU_Form=shop_info.shop_sku.SKU_Form;
							if(shop_info.shop_sku.SKU_Style){
								var obj=shop_info.shop_sku.SKU_Style;
								var yanse='';
								$.each(obj, function(key, val) {
									if(key==0){
										input_yanse='<input type="hidden"  id="yanse" value="'+val.modifyValue+'" />';
										yanse+='<li class="selected" ><a href="javascript:void(0);" title="'+val.modifyValue+'"><span class="value-label">'+val.modifyValue+'</span></a><i></i></li>';
									}else{
										yanse+='<li><a href="javascript:void(0);" title="'+val.modifyValue+'"><span class="value-label">'+val.modifyValue+'</span></a></li>';
									}
								});
								content+='<dl class="attr"><dt class="dt">颜色：</dt><dd class="dd"><ul>'+input_yanse+yanse+'</ul></dd></dl>';
							}
							//规格
							if(shop_info.shop_sku.SKU_Spec){
								var obj=shop_info.shop_sku.SKU_Spec;
								var guige='';
								$.each(obj, function(key, val) {
									if(key==0){
										input_guige='<input type="hidden"  id="guige" value="'+val.modifyValue+'" />';
										guige+='<li class="selected" ><a href="javascript:void(0);" title="'+val.modifyValue+'"><span class="value-label">'+val.modifyValue+'</span></a><i></i></li>';
									}else{
										guige+='<li><a href="javascript:void(0);" title="'+val.modifyValue+'"><span class="value-label">'+val.modifyValue+'</span></a></li>';
									}
								});
									content+='<dl class="attr"><dt class="dt">规格：</dt><dd class="dd"><ul>'+input_guige+guige+'</ul></dd></dl>';
							}
						}
						
						content+='<div class="choose-btn"><dl class="amount"><dt class="dt" style="width: 70px;">购买数量：</dt><dd class="dd"><span class="amount-widget">'+
						'<input type="number" class="amount-input" id="c_num" value="1" maxlength="8" title="请输入购买量" onkeyup="checkNum(this.value)"><span class="amount-btn">'+
						'<span class="amount-plus"><i>+</i></span><span class="amount-minus"><i>-</i></span></span><span class="amount-unit">件</span></span></dd></dl>'+
						'<input type="button" class="btn btn-primary pingtuan" value="立即拼团">'+
						'<input type="button" class="btn pop-choose-spec-close layui-layer-close" value="取消"></div></div></div>';
						layer.open({
						  type: 1,
						  title: false,
						  closeBtn: 0,
						  shadeClose: true,
						  skin: 'yourclass',
						  content: content
						});
					}, "json");
				});
				$("body").delegate(".attr dd ul li","click",function(){
					$(this).siblings('.selected i').remove();
					$(this).siblings().removeClass('selected');
					$(this).addClass('selected');
					$(this).append('<i></i>');
					var attr =$(this).find('span').text();
					$(this).siblings('input').val(attr);
				});
				$("body").delegate(".amount-plus","click",function(){
					var t = $(".amount-input");
					t.val(parseInt(t.val())+1);  
		        	$("#min").removeAttr("disabled");
				});
				$("body").delegate(".amount-minus","click",function(){
					var t = $(".amount-input");
					if (parseInt(t.val())>1) {                   
		                t.val(parseInt(t.val())-1)  
		            }else{  
		                $("#min").attr("disabled","disabled")   
		            } 
				});
				$("body").delegate(".pingtuan","click",function(event){
					
					var id=shop_info.id;
				
					$.post('/cart/add_cart', {
						id: id,
						yanse: yanse,
						guige: guige,				
						num: num,
						buygood:1,
						
					}, function(result) {
						if(result.code==1){
							$(".layui-layer-close").trigger("click");
							var img = $('.goods-thumb').attr('src'); 
							shop_fly(img,event);
							var count=$('.cart_num').html();
							var count= parseInt(count);
							var count= count+num;
							$('.cart_num').html(count);
							$('.sidebar-cartbox-goods-list').remove();
							get_cart_info();
							
						 }
					}, "json");
					
					var uid='{$uid}';
					var ctuan_id='{$tuan_is_first_id}';
					
					if(uid){
						var id = '{$shop_info.id}';
						var yanse=$('#yanse').val();
						var guige=$('#guige').val();
						var num=$('#c_num').val();
						var num= parseInt(num);
						$.post('/cart/add_cart', {
							id: id,
							yanse: yanse,
							guige: guige,
							num: num,
							ctuan_id:ctuan_id,
							type:1,
							buygood:1,
						}, function(result) {
							if(result.code == 1) {
								buy_now();
							}else{
								layer.msg(result.message);
							}
						}, "json");
					}else{
						self.location = '/user/login';
					}
				});
			})
			function buy_now() {
				$.post('/pay/buy_now', {}, function(result) {
					if(result.code == 1) {
						self.location = '/pay/paymentOrder';
					}
					if(result.code == 2) {
						self.location = '/user/login';
					}
					if(result.code == 3) {
						layer.msg('网络出现问题请检查！');
					}
				}, "json");
			}
		</script>
	</body>

</html>